package com.kfm.base.reflect;

import java.sql.SQLException;
import java.util.List;

public class DBHelperTest {

    public static void main(String[] args) {
        String url = "jdbc:mysql://localhost:3306/company?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false";
        String user = "root";
        String pass = "";

        DBHelper db = new DBHelper(url, user, pass);

//        String sql = "select *, empno no from emp where empno = ?";
//        String sql = "select * from dept";
//        String sql = "select * from salgrade where grade = ?";
        String sql = "select * from user";
        try {
            List<User> depts = db.selectList(sql, User.class);

            for (User dept : depts) {
                System.out.println(dept);
            }

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
